#!/bin/sh
cd $(dirname $0)
PWD=$(pwd)
rtp=$HOME/.vim

if [ -e $HOME/.vimrc ]; then
  echo "$HOME/.vimrc exists!"
  echo "Please backup and remove it to run install."
  exit 1
fi

ln -s $PWD/vimrc $HOME/.vimrc

if [ ! -e $rtp/files/backup ]; then
  mkdir -p $rtp/files/backup
fi
if [ ! -e $rtp/files/undo ]; then
  mkdir -p $rtp/files/undo
fi
if [ ! -e $rtp/files/swap ]; then
  mkdir -p $rtp/files/swap
fi
if [ ! -e $rtp/files/view ]; then
  mkdir -p $rtp/files/view
fi
if [ ! -e $rtp/files/info ]; then
  mkdir -p $rtp/files/info
fi

# -___/\/\___-# use plug #-
if [ ! -e $rtp/autoload/plug.vim ]; then
  curl -fLo $rtp/autoload/plug.vim --create-dirs \
    https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
fi
vim +PlugInstall

# vim: set tabstop=2 shiftwidth=2 softtabstop=2 expandtab :
